const p1 = Promise.resolve().then(() => {
    return 100
})
console.log('p1', p1)
p1.then(() => {
    console.log('123')
})
const p2 = Promise.resolve().then(() => {
    throw new Error('错误')
})
console.log('p2', p2)
p2.then(() => {
    console.log('456')
}).catch(err => {
    console.log('err', err)
})

const p3 = Promise.reject('my err').catch(err => {
    console.error(err)
})
p3.then(() => {
    console.log(100)
})
console.log('p3', p3) // resolved 触发then回调

const p4 = Promise.reject('my err').catch(err => {
    throw new Error('catch err')
})
console.log('p4', p4) // rejected 触发catch回调
p4.then(() => {
    console.log(200)
})
p4.catch(() => {
    console.log(300)
})
